//
//  CommentListModelVC.m
//  YZZX
//
//  Created by Easaa on 15/4/27.
//  Copyright (c) 2015年 Easaa. All rights reserved.
//

#import "CommentListModelVC.h"
#import "CommentDataModel.h"
#import "CommentQuoteData.h"
#import "CommentListTableViewModel.h"

#import "CommentView.h"

@interface CommentListModelVC ()<UIScrollViewDelegate,CommentViewDeledaget>
{
    UIScrollView    *ScrollBackground;


}

@end

@implementation CommentListModelVC
{
    CommentListTableViewModel *Commenttablview;   //tableview的创建
    UIView  *viewbgss;
    UIControl *ButCommten;
    
}






-(void)showTableview
{
    
    [viewbgss removeFromSuperview];
    
    [self CreayUI];
    
}

-(id)initWithDatadic:(NSDictionary *)dic
{
    self = [super init];
    if(self)
    {
        self.DicData = dic;
        self.Title_massge = [dic objectForKey:@"Title"];
        self.id_massge    = [dic objectForKey:@"id"];
        
        CommentDataModel *CommentModelData = [[CommentDataModel alloc]initWithDataModel:dic];
        self.arryDta = [CommentModelData categoryListRequestWithObjectID:CommentModelData.id_massge];
    
      
    }
    
    return self;
    
    
}


-(void)CommtenViewSetTextTitle
{
    
    CommentView  *commeview = [[CommentView alloc]initWithViewComment:CGRectMake(0, 0, Dev_ScreenWidth, Dev_ScreenHeight) conmmid:self.id_massge];
    
    commeview.delegaecomme = self;
    
    [[UIApplication sharedApplication].keyWindow addSubview:commeview];
    
}


-(void)CreayUI
{
    
    viewbgss = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Dev_ScreenWidth, Dev_ScreenHeight-64)];
    [self.view addSubview:viewbgss];

    
    Commenttablview = [[CommentListTableViewModel alloc]initWithFram:CGRectMake(0, 0,Dev_ScreenWidth , Dev_ScreenHeight-64-40) ObjectID: self.DicData];
    [viewbgss addSubview:Commenttablview];
    
    
 
    
    
    ButCommten = [[UIControl alloc]initWithFrame:CGRectMake(0, Dev_ScreenHeight-64-40, Dev_ScreenWidth, 40)];
    [ButCommten addTarget:self action:@selector(CommtenViewSetTextTitle) forControlEvents:UIControlEventTouchUpInside];
    [viewbgss addSubview:ButCommten];
    // ButCommten.backgroundColor = [UIColor greenColor];
    
    
    UIView *viewbackground = [[UIView alloc]initWithFrame:CGRectMake(2, 2, Dev_ScreenWidth-4, 40-4)];
    //viewbackground.backgroundColor = [UIColor redColor];
    viewbackground.userInteractionEnabled = NO;
    [viewbackground.layer setMasksToBounds:YES];
    [viewbackground.layer setCornerRadius:3.0]; //设置矩圆角半径
    [viewbackground.layer setBorderWidth:1.0];   //边框宽度
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 0, 0, 0, 0.5 });
    [viewbackground.layer setBorderColor:colorref];//边框颜色
    
    [ButCommten addSubview:viewbackground];
    
    
    
    
    
    UIImageView *iamgeviewbg = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 31, 31)];
    iamgeviewbg.image = [UIImage imageNamed:@"module_comment_write.png"];
    [ButCommten addSubview:iamgeviewbg];
    
    
    
    
    
    UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(40, 2, Dev_ScreenWidth-40, 40)];
    labelTitle.font = [UIFont boldSystemFontOfSize:14.0f];  //UILabel的字体大小
    labelTitle.numberOfLines = 1;  //必须定义这个属性，否则UILabel不会换行
    //    labelTitle.textColor = RGBCOLOR(0, 0, 147);
    
    labelTitle.textAlignment = NSTextAlignmentLeft;  //文本对齐方式
    //[labelTitle setBackgroundColor:[UIColor redColor]];
    labelTitle.text =@"写评论";
    [ButCommten addSubview:labelTitle];
    

  
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.title =@"评论";
    [self CreayUI];
    
    
   
}






@end
